package Cau9;

import java.awt.Graphics;
import java.io.Serializable;

public class Rectangle implements Serializable {

	private static final long serialVersionUID = 1L;
	private int[] xPoint;
	private int[] yPoint;
	public Rectangle()
	{
		setSquare(0,0,0,0);
	}
	public void setSquare(int x, int y, int width, int height) {
		xPoint = new int[5];
		yPoint = new int[5];
		xPoint[0] = x;		yPoint[0] = y;
		xPoint[1] = x+width;yPoint[1] = y;
		xPoint[2] = x+width;yPoint[2] = y+height;
		xPoint[3] = x;		yPoint[3] = y+height;
		xPoint[4] = xPoint[0];yPoint[4] = yPoint[0];
	}	
	public void drawRectangle(Graphics g)
	{
		g.drawPolygon(xPoint, yPoint, 5);
	}
	public void fillRectangle(Graphics g)
	{
		g.fillPolygon(xPoint, yPoint, 4);
	}
}
